home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.internetmci.com!xmission!news
- From: tknarr@xmission.com ( Todd Knarr )
- Newsgroups: comp.lang.c++
- Subject: Re: Question: outLined inlines/ Vtab replication
- Date: 9 Mar 1996 03:43:57 GMT
- Organization: Chaos Central
- Message-ID: <4hqupt$ch1@news.xmission.com>
- References: <4hp08l$5sd@newdelph.cig.mot.com>
- Reply-To: tknarr@xmission.com ( Todd Knarr )
- NNTP-Posting-Host: slc110.xmission.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4hp08l$5sd@newdelph.cig.mot.com>, Martin O'Hara <oharam> writes:
- >If a function is declared inline by the programmer but the address of this
- >function is taken in the code somewhere then the compiler will generate a
- >callable function. This may also happpen if the inline is recursive or too big.
-
- >Q. Is a copy of such a function placed in each translation unit in which it
- >is needed ( code duplication). Is this an "outlined inline"?
-
- Yes and/or no. Most compilers probably include a seperate copy in each
- translation unit. A really smart compiler could detect this and suppress
- the duplication.
-
- >Q. Can there exist inline expanded code representing the function and also a
- >callable version of the function in different parts of a program.? Or will the
- >compiler decide that if all occorrences of the function cannot be inline
- >expanded then the function will just be a normal one?
-
- That depends on the compiler and how you compiled. If you're compiling with
- a traditional seperate-compilation compiler, the compiler has no knowledge
- of what happened in any other modules so it doesn't even realize that that
- inline function was outlined elsewhere. It will generally use one or the other
- within a module, but it's entirely permissible to vary from one module in a
- program to another.
-
- If your compiler is such that it does keep track of the state of the entire
- program at all times, it may alter any module to conform to other modules.
- This is permissible but not required. The only thing that's required is that
- you can't put in two versions of the same inline function with different
- bodies ( although detecting this with a seperate-compilation compiler is
- highly non-trivial ).
-
- --
- Todd Knarr : tknarr@xmission.com | finger for PGP public key
- | Member, USENET Cabal
-
- Seriously, I don't want to die just yet. I don't care how
- good-looking they are, I! don't! want! to! die!"
- -- Megazone ( UF1 )
-
-